package com.secondshop.mappers;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import com.secondshop.models.FirstType;
import com.secondshop.models.SecondType;

public interface FirstTypeMapper {
	//查询所有一级分类
	@Select("select * from first_type_table;")
	List<FirstType> getAllFirstType();
	//一级分类排序查找最早的那条
	@Select("select id from first_type_table ORDER BY id desc limit 0, 1;")
	Integer getFirstTypeLastId();
	//根据first_type_id 查询一级分类
	@Select("select * from first_type_table where first_type_id = #{firstTypeId}")
	List<FirstType> getFirstTypeById(int firstTypeId);
	//插入一级分类
	@Insert("insert into first_type_table(id, name) values(#{id}, #{name});")
	int createFirstType(FirstType firstType);
	//删除一级分类
	@Delete("delete from first_type_table where id = #{firstTypeId};")
	int deleteFirstType(Integer firstTypeId);

	

}
